const Events = require('../models/Events')

async function createEvent(data) {
  return await Events.create(data)
}
async function getAllEvents() {
  return await Events.findAll()
}
async function getEventById(id) {
  return await Events.findByPk(id)
}
async function updateEvent(id, data) {
  return await Events.update(data, { where: { id } })
}
async function deleteEvent(id) {
  return await Events.destroy({ where: { id } })
}

module.exports = {
  createEvent,
  getAllEvents,
  getEventById,
  updateEvent,
  deleteEvent,
}
